
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>实践 · 梦里茶</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        <meta name="author" content="陈伟航">
        
        
    
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-disqus/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-toggle-chapters/toggle.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../styles/website.css">
        
    
        
    
        
    
        
    
        
    
        
    


    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../kit/" />
    
    
    <link rel="prev" href="../trick/l2_normalize.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../android/">
            
                <a href="../../android/">
            
                    
                    Android
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../android/activity/">
            
                <a href="../../android/activity/">
            
                    
                    activity
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="../../android/activity/Activity四种启动模式.html">
            
                <a href="../../android/activity/Activity四种启动模式.html">
            
                    
                    Activity四种启动模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="../../android/activity/INTENT_FLAG.html">
            
                <a href="../../android/activity/INTENT_FLAG.html">
            
                    
                    Intent Flag
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.3" data-path="../../android/activity/多TASK的应用.html">
            
                <a href="../../android/activity/多TASK的应用.html">
            
                    
                    多task的应用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.4" data-path="../../android/activity/Task和回退栈.html">
            
                <a href="../../android/activity/Task和回退栈.html">
            
                    
                    Task和回退栈
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../../android/sqlite/">
            
                <a href="../../android/sqlite/">
            
                    
                    sqlite
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../../android/sqlite/从源码看ANDROID中SQLITE是怎么通过CURSORWINDOW读DB的.html">
            
                <a href="../../android/sqlite/从源码看ANDROID中SQLITE是怎么通过CURSORWINDOW读DB的.html">
            
                    
                    【源码】CursorWindow读DB
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="../../android/sqlite/SQLITE在ANDROID上的一个BUG.html">
            
                <a href="../../android/sqlite/SQLITE在ANDROID上的一个BUG.html">
            
                    
                    Sqlite在Android上的一个Bug
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../../android/chromium/">
            
                <a href="../../android/chromium/">
            
                    
                    Chromium
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../../android/listview_db.html">
            
                <a href="../../android/listview_db.html">
            
                    
                    ListView读取DB数据最佳实践
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../../android/Android_project结构.html">
            
                <a href="../../android/Android_project结构.html">
            
                    
                    Android Project结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../../android/一个由PROGUARD与FASTJSON引起的血案.html">
            
                <a href="../../android/一个由PROGUARD与FASTJSON引起的血案.html">
            
                    
                    一个由Proguard与FastJson引起的血案
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="../../android/note.html">
            
                <a href="../../android/note.html">
            
                    
                    琐碎的一些tips
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../">
            
                <a href="../">
            
                    
                    Machine Learning
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../trick/">
            
                <a href="../trick/">
            
                    
                    技巧
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1.1" data-path="../trick/imgnet_1h.html">
            
                <a href="../trick/imgnet_1h.html">
            
                    
                    FaceBook: 1 hour training ImageNet
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.2" data-path="../trick/l2_normalize.html">
            
                <a href="../trick/l2_normalize.html">
            
                    
                    L2 Norm与L2 normalize
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter active" data-level="1.3.2" data-path="ncs.html">
            
                <a href="ncs.html">
            
                    
                    实践
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../kit/">
            
                <a href="../kit/">
            
                    
                    工具
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.1" >
            
                <a target="_blank" href="https://github.com/ahangchen/GDLNotes">
            
                    
                    Tensorflow学习笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2" data-path="../kit/caffe/mscnn.html">
            
                <a href="../kit/caffe/mscnn.html">
            
                    
                    mscnn
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.3" data-path="../matlab/">
            
                <a href="../matlab/">
            
                    
                    Matlab
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.3.1" data-path="../matlab/ripc_auto.html">
            
                <a href="../matlab/ripc_auto.html">
            
                    
                    Matlab Remote IPC自动化数据处理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../papers/">
            
                <a href="../papers/">
            
                    
                    讲座论文系列
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.4.1" data-path="../reid/">
            
                <a href="../reid/">
            
                    
                    Re-identification
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.4.1.1" data-path="../papers/TFusion.html">
            
                <a href="../papers/TFusion.html">
            
                    
                    CVPR2018:TFusion完全解读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.1.2" data-path="../reid/reid.html">
            
                <a href="../reid/reid.html">
            
                    
                    Person Re-identification
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.1.3" data-path="../reid/cvpr-reid.html">
            
                <a href="../reid/cvpr-reid.html">
            
                    
                    CVPR2016 Re-id
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.1.4" data-path="../reid/reid-topo.html">
            
                <a href="../reid/reid-topo.html">
            
                    
                    Camera topology and Person Re-id
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.1.5" data-path="../reid/deep_transfer_learning_person_reid.html">
            
                <a href="../reid/deep_transfer_learning_person_reid.html">
            
                    
                    Deep transfer learning Person Re-id
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.1.6" data-path="../reid/evaluate.html">
            
                <a href="../reid/evaluate.html">
            
                    
                    Evaluate
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.4.2" data-path="../papers/detection/">
            
                <a href="../papers/detection/">
            
                    
                    Object Detection
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.4.2.1" data-path="../papers/detection/rcnn.html">
            
                <a href="../papers/detection/rcnn.html">
            
                    
                    读论文系列·干货满满的RCNN
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.2.2" data-path="../papers/detection/sppnet.html">
            
                <a href="../papers/detection/sppnet.html">
            
                    
                    读论文系列·SPP-net
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.2.3" data-path="../papers/detection/fast_rcnn.html">
            
                <a href="../papers/detection/fast_rcnn.html">
            
                    
                    读论文系列·Fast RCNN
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.2.4" data-path="../papers/detection/faster_rcnn.html">
            
                <a href="../papers/detection/faster_rcnn.html">
            
                    
                    读论文系列·Faster RCNN
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.2.5" data-path="../papers/detection/yolo.html">
            
                <a href="../papers/detection/yolo.html">
            
                    
                    读论文系列·YOLO
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.2.6" data-path="../papers/detection/ssd.html">
            
                <a href="../papers/detection/ssd.html">
            
                    
                    读论文系列·SSD
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.2.7" data-path="../papers/detection/yolo23.html">
            
                <a href="../papers/detection/yolo23.html">
            
                    
                    读论文系列·YOLOv2 & YOLOv3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.2.8" data-path="../papers/detection/other.html">
            
                <a href="../papers/detection/other.html">
            
                    
                    读论文系列·detection其他文章推荐
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.4.3" >
            
                <span>
            
                    
                    Hashing
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.4.3.1" data-path="../papers/hashing/ssah.html">
            
                <a href="../papers/hashing/ssah.html">
            
                    
                    CVPR2018: SSAH
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.4.4" >
            
                <span>
            
                    
                    大杂烩
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.4.4.1" data-path="../papers/cncc2017.html">
            
                <a href="../papers/cncc2017.html">
            
                    
                    CNCC2017 琐记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.4.2" data-path="../papers/eccv2016_hydra_ccnn.html">
            
                <a href="../papers/eccv2016_hydra_ccnn.html">
            
                    
                    ECCV 2016 Hydra CCNN
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.4.3" data-path="../papers/cncc_cv.html">
            
                <a href="../papers/cncc_cv.html">
            
                    
                    CNCC2017深度学习与跨媒体智能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4.4.4" data-path="../papers/mla_2016.html">
            
                <a href="../papers/mla_2016.html">
            
                    
                    MLA2016笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../zzh_ml_notes.html">
            
                <a href="../zzh_ml_notes.html">
            
                    
                    《机器学习》（周志华）读书笔记
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.5.1" data-path="../melon/">
            
                <a href="../melon/">
            
                    
                    西瓜书概念整理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.5.1.1" data-path="../melon/ch01.html">
            
                <a href="../melon/ch01.html">
            
                    
                    绪论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.2" data-path="../melon/ch02.html">
            
                <a href="../melon/ch02.html">
            
                    
                    模型评估与选择
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.3" data-path="../melon/ch03.html">
            
                <a href="../melon/ch03.html">
            
                    
                    线性模型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.4" data-path="../melon/ch04.html">
            
                <a href="../melon/ch04.html">
            
                    
                    决策树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.5" data-path="../melon/ch05.html">
            
                <a href="../melon/ch05.html">
            
                    
                    神经网络
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.6" data-path="../melon/ch06.html">
            
                <a href="../melon/ch06.html">
            
                    
                    支持向量机
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.7" data-path="../melon/ch07.html">
            
                <a href="../melon/ch07.html">
            
                    
                    贝叶斯分类器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.8" data-path="../melon/ch08.html">
            
                <a href="../melon/ch08.html">
            
                    
                    集成学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.9" data-path="../melon/ch09.html">
            
                <a href="../melon/ch09.html">
            
                    
                    聚类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.10" data-path="../melon/ch10.html">
            
                <a href="../melon/ch10.html">
            
                    
                    降维与度量学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.11" data-path="../melon/ch11.html">
            
                <a href="../melon/ch11.html">
            
                    
                    特征选择与稀疏学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.12" data-path="../melon/ch12.html">
            
                <a href="../melon/ch12.html">
            
                    
                    计算学习理论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.13" data-path="../melon/ch13.html">
            
                <a href="../melon/ch13.html">
            
                    
                    半监督学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.14" data-path="../melon/ch14.html">
            
                <a href="../melon/ch14.html">
            
                    
                    概率图模型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.15" data-path="../melon/ch15.html">
            
                <a href="../melon/ch15.html">
            
                    
                    规则学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.16" data-path="../melon/ch16.html">
            
                <a href="../melon/ch16.html">
            
                    
                    强化学习
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5.1.17" data-path="../melon/ch17.html">
            
                <a href="../melon/ch17.html">
            
                    
                    附录
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../java/">
            
                <a href="../../java/">
            
                    
                    Java
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../java/java-web/note.html">
            
                <a href="../../java/java-web/note.html">
            
                    
                    java web
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1.1" data-path="../../java/java-web/Servlet组织.html">
            
                <a href="../../java/java-web/Servlet组织.html">
            
                    
                    Servlet部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.2" data-path="../../java/java-web/note.html">
            
                <a href="../../java/java-web/note.html">
            
                    
                    琐碎的tips
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../../java/jni/note.html">
            
                <a href="../../java/jni/note.html">
            
                    
                    JNI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../../java/note.html">
            
                <a href="../../java/note.html">
            
                    
                    Note
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../../java/ej/l1-new-delete.html">
            
                <a href="../../java/ej/l1-new-delete.html">
            
                    
                    Effective Java笔记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../../backend/">
            
                <a href="../../backend/">
            
                    
                    后端开发
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../../backend/design.html">
            
                <a href="../../backend/design.html">
            
                    
                    架构设计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../../backend/db.html">
            
                <a href="../../backend/db.html">
            
                    
                    数据库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../../java/java-web/note.html">
            
                <a href="../../java/java-web/note.html">
            
                    
                    java web
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.3.1" data-path="../../java/java-web/Servlet组织.html">
            
                <a href="../../java/java-web/Servlet组织.html">
            
                    
                    Servlet部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3.2" data-path="../../java/java-web/note.html">
            
                <a href="../../java/java-web/note.html">
            
                    
                    琐碎的tips
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../../backend/spring_boot.html">
            
                <a href="../../backend/spring_boot.html">
            
                    
                    Spring boot
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../../python/django/note.html">
            
                <a href="../../python/django/note.html">
            
                    
                    django
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="../../backend/concurrent.html">
            
                <a href="../../backend/concurrent.html">
            
                    
                    分布式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../../linux/note.html">
            
                <a href="../../linux/note.html">
            
                    
                    Linux && Hardware
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../../linux/ubuntu_init.html">
            
                <a href="../../linux/ubuntu_init.html">
            
                    
                    Ubuntu安装与初始配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../../linux/raspbian/">
            
                <a href="../../linux/raspbian/">
            
                    
                    树莓派相关
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.2.1" data-path="../../linux/raspbian/rtlwifi.html">
            
                <a href="../../linux/raspbian/rtlwifi.html">
            
                    
                    树莓派3B+无线网卡监听模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.2" data-path="../../linux/raspbian/tlwr703n_openwrt.html">
            
                <a href="../../linux/raspbian/tlwr703n_openwrt.html">
            
                    
                    TP-LINK TL-WR703N v1.7 openwrt flashing
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../../python/">
            
                <a href="../../python/">
            
                    
                    Python
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../../python/django/note.html">
            
                <a href="../../python/django/note.html">
            
                    
                    django
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../../python/raw.html">
            
                <a href="../../python/raw.html">
            
                    
                    原生模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../../python/design.html">
            
                <a href="../../python/design.html">
            
                    
                    设计模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../../python/viz.html">
            
                <a href="../../python/viz.html">
            
                    
                    可视化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../../python/libs.html">
            
                <a href="../../python/libs.html">
            
                    
                    常用库踩坑指南
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../../web-front/">
            
                <a href="../../web-front/">
            
                    
                    web前端
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../../web-front/head_content.html">
            
                <a href="../../web-front/head_content.html">
            
                    
                    header div固定，content div填充父容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../../web-front/json_res.html">
            
                <a href="../../web-front/json_res.html">
            
                    
                    json接口资源
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../../UI/">
            
                <a href="../../UI/">
            
                    
                    UI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../../kit/">
            
                <a href="../../kit/">
            
                    
                    kit
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../../kit/vim/note.html">
            
                <a href="../../kit/vim/note.html">
            
                    
                    vim
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../../kit/git/note.html">
            
                <a href="../../kit/git/note.html">
            
                    
                    git/github
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.2.1" data-path="../../kit/git/green_blush.html">
            
                <a href="../../kit/git/green_blush.html">
            
                    
                    刷爆github小绿点
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../../kit/markdown/">
            
                <a href="../../kit/markdown/">
            
                    
                    Markdown/gitbook
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.3.1" data-path="../../kit/markdown/pieces.html">
            
                <a href="../../kit/markdown/pieces.html">
            
                    
                    琐碎知识点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3.2" data-path="../../kit/markdown/gitbook_disqus.html">
            
                <a href="../../kit/markdown/gitbook_disqus.html">
            
                    
                    gitbook添加disqus作为评论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3.3" data-path="../../kit/markdown/chrome_mark2_md.html">
            
                <a href="../../kit/markdown/chrome_mark2_md.html">
            
                    
                    导出chrome书签为Markdown
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3.4" data-path="../../kit/markdown/wx_md.html">
            
                <a href="../../kit/markdown/wx_md.html">
            
                    
                    Markdown here && 微信公众号
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../../kit/latex/">
            
                <a href="../../kit/latex/">
            
                    
                    LaTex
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.4.1" data-path="../../kit/latex/note.html">
            
                <a href="../../kit/latex/note.html">
            
                    
                    LaTex琐记
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../../kit/ss/">
            
                <a href="../../kit/ss/">
            
                    
                    科学上网
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../../thinking-in-program/">
            
                <a href="../../thinking-in-program/">
            
                    
                    thinking-in-program
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../../thinking-in-program/log.html">
            
                <a href="../../thinking-in-program/log.html">
            
                    
                    怎样打日志
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../../star.html">
            
                <a href="../../star.html">
            
                    
                    我的收藏
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../../pieces.html">
            
                <a href="../../pieces.html">
            
                    
                    琐记
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../../paper.html">
            
                <a href="../../paper.html">
            
                    
                    论文心得
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../../support.html">
            
                <a href="../../support.html">
            
                    
                    打赏支持
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >实践</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x6811;&#x8393;&#x6D3E;3b&#x82F1;&#x7279;&#x5C14;&#x795E;&#x7ECF;&#x8BA1;&#x7B97;&#x68D2;&#x8FDB;&#x884C;&#x9AD8;&#x901F;&#x76EE;&#x6807;&#x68C0;&#x6D4B;">&#x6811;&#x8393;&#x6D3E;3B+&#x82F1;&#x7279;&#x5C14;&#x795E;&#x7ECF;&#x8BA1;&#x7B97;&#x68D2;&#x8FDB;&#x884C;&#x9AD8;&#x901F;&#x76EE;&#x6807;&#x68C0;&#x6D4B;</h1>
<blockquote>
<p>&#x8F6C;&#x8F7D;&#x8BF7;&#x6CE8;&#x660E;&#x4F5C;&#x8005;<a href="https://github.com/ahangchen" target="_blank">&#x68A6;&#x91CC;&#x8336;</a></p>
</blockquote>
<p><img src="https://upload-images.jianshu.io/upload_images/1828517-1cda688b0ed4638e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="NCS Pi"></p>
<p>&#x4EE3;&#x7801;: 
&#x8BAD;&#x7EC3;&#x6570;&#x636E;&#x9884;&#x5904;&#x7406;&#xFF1A;
<a href="https://gist.github.com/ahangchen/ae1b7562c1f93fdad1de58020e94fbdf" target="_blank">https://gist.github.com/ahangchen/ae1b7562c1f93fdad1de58020e94fbdf</a>
&#x6D4B;&#x8BD5;&#xFF1A;<a href="https://github.com/ahangchen/ncs_detection" target="_blank">https://github.com/ahangchen/ncs_detection</a></p>
<blockquote>
<p>Star&#x662F;&#x4E00;&#x79CD;&#x7F8E;&#x5FB7;&#x3002;</p>
</blockquote>
<h2 id="background">Background</h2>
<p>&#x6700;&#x8FD1;&#x5728;&#x505A;&#x4E00;&#x4E2A;&#x9879;&#x76EE;&#xFF0C;&#x8981;&#x5728;&#x6811;&#x8393;&#x6D3E;&#x4E0A;&#x5206;&#x6790;&#x89C6;&#x9891;&#x4E2D;&#x7684;&#x56FE;&#x7247;&#xFF0C;&#x68C0;&#x6D4B;&#x76EE;&#x6807;&#xFF0C;&#x7EDF;&#x8BA1;&#x76EE;&#x6807;&#x4E2A;&#x6570;&#xFF0C;&#x8FD9;&#x662F;&#x4E00;&#x5F20;&#x6837;&#x4F8B;&#x56FE;&#x7247;&#xFF1A;</p>
<p><img src="https://upload-images.jianshu.io/upload_images/1828517-7405ed85dce8bfde.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="Cattle Counting"></p>
<h2 id="motivation">Motivation</h2>
<p>&#x5F53;&#x4E0B;&#x6548;&#x679C;&#x6700;&#x597D;&#x7684;&#x76EE;&#x6807;&#x68C0;&#x6D4B;&#x90FD;&#x662F;&#x57FA;&#x4E8E;&#x795E;&#x7ECF;&#x7F51;&#x7EDC;&#x6765;&#x505A;&#x7684;&#xFF0C;&#x5305;&#x62EC;faster rcnn&#xFF0C; ssd, yolo2&#x7B49;&#x7B49;&#xFF0C;&#x8981;&#x5728;&#x6811;&#x8393;&#x6D3E;&#x8FD9;&#x79CD;&#x8D44;&#x6E90;&#x7D27;&#x5F20;&#x7684;&#x8BBE;&#x5907;&#x4E0A;&#x8FD0;&#x884C;&#x68C0;&#x6D4B;&#x6A21;&#x578B;&#xFF0C;&#x9996;&#x5148;&#x60F3;&#x5230;&#x7684;&#x5C31;&#x662F;&#x7528;&#x6700;&#x8F7B;&#x91CF;&#x7684;MobileNet SSD&#xFF0C;&#x4F7F;&#x7528;Tensorflow object detection api&#x5B9E;&#x73B0;&#x7684;MobileNet SSD&#x867D;&#x7136;&#x5DF2;&#x7ECF;&#x975E;&#x5E38;&#x8F7B;&#xFF0C;&#x4F46;&#x5728;&#x6811;&#x8393;&#x6D3E;&#x4E0A;&#x63A8;&#x5BFC;&#x4E00;&#x5F20;1280x720&#x7684;&#x56FE;&#x4ECD;&#x7136;&#x9700;&#x8981;2&#x79D2;&#xFF0C;&#x6709;&#x5174;&#x8DA3;&#x7684;&#x540C;&#x5B66;&#x53EF;&#x4EE5;&#x53C2;&#x8003;&#x8FD9;&#x4E24;&#x4E2A;&#x9879;&#x76EE;&#xFF1A;</p>
<ul>
<li>armv7&#x7248;Tensorflow&#xFF08;&#x5FC5;&#x987B;&#x662F;1.4&#x53CA;&#x4EE5;&#x4E0A;&#xFF09;:<a href="https://github.com/lhelontra/tensorflow-on-arm/releases" target="_blank">https://github.com/lhelontra/tensorflow-on-arm/releases</a></li>
<li>Tensorflow Object detection API: <a href="https://github.com/tensorflow/models/tree/master/research/object_detection" target="_blank">https://github.com/tensorflow/models/tree/master/research/object_detection</a></li>
</ul>
<p>&#x5177;&#x4F53;&#x7684;&#x64CD;&#x4F5C;&#x5728;Tensorflow&#x6587;&#x6863;&#x91CC;&#x90FD;&#x8BF4;&#x7684;&#x5F88;&#x6E05;&#x695A;&#x4E86;&#xFF0C;&#x5728;&#x6811;&#x8393;&#x6D3E;&#x4E0A;&#x7684;&#x64CD;&#x4F5C;&#x4E5F;&#x662F;&#x4E00;&#x6837;&#x7684;&#xFF0C;&#x6709;&#x95EE;&#x9898;&#x53EF;&#x4EE5;&#x8BC4;&#x8BBA;&#x533A;&#x8BA8;&#x8BBA;</p>
<h2 id="hardware">Hardware</h2>
<p>&#x6781;&#x9650;&#x7684;&#x6A21;&#x578B;&#x4ECD;&#x7136;&#x4E0D;&#x80FD;&#x6EE1;&#x8DB3;&#x6027;&#x80FD;&#x9700;&#x6C42;&#xFF0C;&#x5C31;&#x9700;&#x8981;&#x8BF7;&#x51FA;&#x6211;&#x4EEC;&#x4ECA;&#x5929;&#x7684;&#x4E3B;&#x89D2;&#x4E86;&#xFF0C;<a href="https://developer.movidius.com/" target="_blank">Intel Movidius Neural Computing Stick</a>
<img src="https://upload-images.jianshu.io/upload_images/1828517-91b7cdc17798b7ef.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="Intel Movidius Neural Computing Stick"></p>
<table>
<thead>
<tr>
<th style="text-align:center">&#x5904;&#x7406;&#x5668;</th>
<th style="text-align:center">Intel Movidius VPU</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">&#x652F;&#x6301;&#x6846;&#x67B6;</td>
<td style="text-align:center">TensorFlow, Caffe</td>
</tr>
<tr>
<td style="text-align:center">&#x8FDE;&#x63A5;&#x65B9;&#x5F0F;</td>
<td style="text-align:center">USB 3.0 Type-A</td>
</tr>
<tr>
<td style="text-align:center">&#x5C3A;&#x5BF8;</td>
<td style="text-align:center">USB stick (72.5mm X 27mm X 14mm)</td>
</tr>
<tr>
<td style="text-align:center">&#x5DE5;&#x4F5C;&#x6E29;&#x5EA6;</td>
<td style="text-align:center">0&#xB0; - 40&#xB0; C</td>
</tr>
<tr>
<td style="text-align:center"></td>
<td style="text-align:center"></td>
</tr>
<tr>
<td style="text-align:center"></td>
<td style="text-align:center">x86_64 Ubuntu 16.04&#x4E3B;&#x673A;</td>
</tr>
<tr>
<td style="text-align:center"></td>
<td style="text-align:center">Raspberry Pi 3B  Stretch desktop</td>
</tr>
<tr>
<td style="text-align:center"></td>
<td style="text-align:center">Ubuntu 16.04 &#x865A;&#x62DF;&#x673A;</td>
</tr>
<tr>
<td style="text-align:center">&#x7CFB;&#x7EDF;&#x8981;&#x6C42;</td>
<td style="text-align:center">USB 2.0 &#x4EE5;&#x4E0A; (&#x63A8;&#x8350; USB 3.0)</td>
</tr>
<tr>
<td style="text-align:center"></td>
<td style="text-align:center">1GB &#x5185;&#x5B58;</td>
</tr>
<tr>
<td style="text-align:center"></td>
<td style="text-align:center">4GB &#x5B58;&#x50A8;</td>
</tr>
<tr>
<td style="text-align:center"></td>
</tr>
</tbody>
</table>
<p>&#x5B9E;&#x9645;&#x4E0A;&#x8FD9;&#x4E0D;&#x662F;&#x4E00;&#x4E2A;GPU&#xFF0C;&#x800C;&#x662F;&#x4E00;&#x4E2A;&#x4E13;&#x7528;&#x8BA1;&#x7B97;&#x82AF;&#x7247;&#xFF0C;&#x4F46;&#x80FD;&#x8D77;&#x5230;&#x7C7B;&#x4F3C;GPU&#x5BF9;&#x795E;&#x7ECF;&#x7F51;&#x7EDC;&#x8FD0;&#x7B97;&#x7684;&#x52A0;&#x901F;&#x4F5C;&#x7528;&#x3002;</p>
<p>&#x4EAC;&#x4E1C;&#x4E0A;&#x641C;&#x540D;&#x5B57;&#x53EF;&#x4EE5;&#x4E70;&#x5230;&#xFF0C;&#x53EA;&#x8981;500&#x5143;&#x5DE6;&#x53F3;&#xFF0C;&#x60F3;&#x60F3;&#x4E00;&#x5757;GPU&#x90FD;&#x8981;&#x51E0;&#x5343;&#x5757;&#x94B1;&#xFF0C;&#x5C31;&#x4F1A;&#x89C9;&#x5F97;&#x5F88;&#x503C;&#x4E86;&#x3002;</p>
<p>SDK&#x662F;&#x5F00;&#x6E90;&#x7684;&#xFF1A;<a href="https://github.com/movidius/ncsdk" target="_blank">https://github.com/movidius/ncsdk</a></p>
<p>&#x63D0;&#x95EE;&#x4E0D;&#x5728;GitHub issue&#x91CC;&#xFF0C;&#x800C;&#x662F;&#x5728;&#x4E00;&#x4E2A;&#x4E13;&#x95E8;&#x7684;&#x8BBA;&#x575B;&#xFF1A;<a href="https://ncsforum.movidius.com/" target="_blank">https://ncsforum.movidius.com/</a></p>
<p>&#x867D;&#x7136;&#x76EE;&#x524D;NCSDK&#x652F;&#x6301;&#x7684;&#x6846;&#x67B6;&#x5305;&#x542B;Tensorflow&#x548C;Caffe&#xFF0C;&#x4F46;&#x5E76;&#x4E0D;&#x662F;&#x652F;&#x6301;&#x6240;&#x6709;&#x7684;&#x6A21;&#x578B;&#xFF0C;&#x76EE;&#x524D;&#x5DF2;&#x652F;&#x6301;&#x7684;&#x6A21;&#x578B;&#x5217;&#x8868;&#x53EF;&#x4EE5;&#x5728;&#x8FD9;&#x91CC;&#x67E5;&#x5230;&#xFF1A;<a href="https://github.com/movidius/ncsdk/releases" target="_blank">https://github.com/movidius/ncsdk/releases</a></p>
<p>&#x622A;&#x6B62;&#x5230;2018&#x5E74;3&#x6708;15&#x65E5;&#xFF0C;NCSDK&#x8FD8;&#x6CA1;&#x6709;&#x652F;&#x6301;Tensorflow&#x7248;&#x7684;MobileNet SSD&#xFF08;&#x6BD4;&#x5982;<code>tf.cast</code>&#x8FD9;&#x4E2A;&#x64CD;&#x4F5C;&#x8FD8;&#x672A;&#x88AB;&#x652F;&#x6301;&#xFF09;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x7528;Caffe&#x6765;&#x8BAD;&#x7EC3;&#x6A21;&#x578B;&#xFF0C;&#x90E8;&#x7F72;&#x5230;&#x6811;&#x8393;&#x6D3E;&#x4E0A;&#x3002;</p>
<h2 id="environment">Environment</h2>
<p>ncsdk&#x7684;&#x73AF;&#x5883;&#x5206;&#x4E3A;&#x4E24;&#x90E8;&#x5206;&#xFF0C;&#x8BAD;&#x7EC3;&#x7AEF;&#x548C;&#x6D4B;&#x8BD5;&#x7AEF;&#x3002;</p>
<ul>
<li>&#x8BAD;&#x7EC3;&#x7AEF;&#x901A;&#x5E38;&#x662F;&#x4E00;&#x4E2A;Ubuntu &#x5E26;GPU&#x4E3B;&#x673A;&#xFF0C;&#x8BAD;&#x7EC3;Caffe&#x6216;TensorFlow&#x6A21;&#x578B;&#xFF0C;&#x7F16;&#x8BD1;&#x6210;NCS&#x53EF;&#x4EE5;&#x6267;&#x884C;&#x7684;graph&#xFF1B;</li>
<li>&#x6D4B;&#x8BD5;&#x7AEF;&#x5219;&#x9762;&#x5411;ncs python mvnc api&#x7F16;&#x7A0B;&#xFF0C;&#x53EF;&#x4EE5;&#x8FD0;&#x884C;&#x5728;&#x6811;&#x8393;&#x6D3E;&#x4E0A;raspbian stretch&#x7248;&#x672C;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x8FD0;&#x884C;&#x5728;&#x8BAD;&#x7EC3;&#x7AEF;&#x8FD9;&#x79CD;&#x673A;&#x5668;&#x4E0A;&#x3002;</li>
</ul>
<h3 id="&#x8BAD;&#x7EC3;&#x7AEF;">&#x8BAD;&#x7EC3;&#x7AEF;</h3>
<h4 id="&#x5B89;&#x88C5;">&#x5B89;&#x88C5;</h4>
<p>&#x5B89;&#x88C5;&#x8FD9;&#x4E2A;&#x8FC7;&#x7A0B;&#xFF0C;&#x8BF4;&#x96BE;&#x4E0D;&#x96BE;&#xFF0C;&#x4E5F;&#x5C31;&#x51E0;&#x884C;&#x547D;&#x4EE4;&#x7684;&#x4E8B;&#x60C5;&#xFF0C;&#x4F46;&#x4E5F;&#x6709;&#x5F88;&#x591A;&#x5751;</p>
<p>&#x5728;&#x8BAD;&#x7EC3;&#x7AEF;&#x4E3B;&#x673A;&#x4E0A;&#xFF0C;&#x63D2;&#x5165;&#x795E;&#x7ECF;&#x8BA1;&#x7B97;&#x68D2;&#xFF0C;&#x7136;&#x540E;&#xFF1A;</p>
<pre><code>git clone https://github.com/movidius/ncsdk
cd ncsdk
make install
</code></pre><p>&#x5176;&#x4E2D;&#xFF0C;make install&#x5E72;&#x7684;&#x662F;&#x8FD9;&#x4E9B;&#x4E8B;&#x60C5;&#xFF1A;</p>
<ul>
<li>&#x68C0;&#x67E5;&#x5B89;&#x88C5;Tensorflow</li>
<li>&#x68C0;&#x67E5;&#x5B89;&#x88C5;Caffe(<a href="https://github.com/weiliu89/caffe" target="_blank">SSD-caffe</a>)</li>
<li>&#x7F16;&#x8BD1;&#x5B89;&#x88C5;ncsdk&#xFF08;&#x4E0D;&#x5305;&#x542B;inference&#x6A21;&#x5757;&#xFF0C;&#x53EA;&#x5305;&#x542B;mvNCCompile&#x76F8;&#x5173;&#x6A21;&#x5757;&#xFF0C;&#x7528;&#x6765;&#x5C06;Caffe&#x6216;Tensorflow&#x6A21;&#x578B;&#x8F6C;&#x6210;NCS graph&#x7684;&#xFF09;</li>
</ul>
<p>&#x6CE8;&#x610F;&#xFF0C;</p>
<ul>
<li>&#x8FD9;&#x4E9B;&#x5E93;&#x90FD;&#x662F;&#x5B89;&#x88C5;&#x5230;<code>/opt/movidius/</code>&#x8FD9;&#x4E2A;&#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x5E76;&#x5173;&#x8054;&#x5230;&#x7CFB;&#x7EDF;python3&#x91CC;&#x8FB9;&#x7684;&#xFF08;<code>/usr/bin/python3</code>&#xFF09;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x7535;&#x8111;&#x91CC;&#x539F;&#x6765;&#x6709;tf&#x6216;caffe&#xFF0C;&#x4E5F;&#x4E0D;&#x4F1A;&#x88AB;&#x5173;&#x8054;&#x4E0A;&#x53BB;</li>
<li>NCSDK mvNCCompile&#x6A21;&#x5757;&#x76EE;&#x524D;&#x53EA;&#x517C;&#x5BB9;python3&#xFF0C;&#x6211;&#x5C1D;&#x8BD5;&#x8FC7;&#x5C06;&#x5B89;&#x88C5;&#x5B8C;&#x7684;SDK&#x6539;&#x6210;&#x517C;&#x5BB9;python2&#x7684;&#x7248;&#x672C;&#xFF0C;&#x53EF;&#x4EE5;&#x5C06;&#x6A21;&#x578B;&#x7F16;&#x8BD1;&#x51FA;&#x6765;&#xFF0C;&#x4F46;&#x662F;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x4F1A;&#x62A5;&#x9519;&#xFF0C;&#x6240;&#x4EE5;&#x6682;&#x65F6;&#x653E;&#x5F03;&#x517C;&#x5BB9;python2&#x4E86;&#xFF0C;&#x4E5F;&#x5EFA;&#x8BAE;&#x5927;&#x5BB6;&#x7528;&#x9ED8;&#x8BA4;&#x7684;python3&#x7248;&#x672C;</li>
<li><p>&#x8FD9;&#x4E2A;&#x6B65;&#x9AA4;&#x4E3B;&#x8981;&#x7684;&#x5751;&#x6765;&#x81EA;&#x4E07;&#x6076;&#x7684;Caffe&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x88C5;&#x8FC7;python3&#x7248;&#x7684;caffe&#xFF0C;&#x5927;&#x6982;&#x4F1A;&#x6709;&#x7ECF;&#x9A8C;&#x4E00;&#x4E9B;&#xFF0C;&#x8FD9;&#x91CC;&#x6709;&#x51E0;&#x4E2A;&#x5C0F;&#x5751;&#x63D0;&#x793A;&#x4E00;&#x4E0B;&#xFF1A;</p>
<ul>
<li>&#x6700;&#x597D;&#x5728;ncsdk&#x76EE;&#x5F55;&#x4E2D;&#x7684;ncsdk.conf&#x4E2D;&#xFF0C;&#x5F00;&#x542F;caffe&#x7684;cuda&#x652F;&#x6301;&#xFF0C;&#x5373;&#x8BBE;&#x7F6E;<code>CAFFE_USE_CUDA=yes</code>&#xFF0C;&#x8FD9;&#x6837;&#x4F60;&#x4E4B;&#x540E;&#x4E5F;&#x80FD;&#x7528;&#x8FD9;&#x4E2A;caffe&#x6765;&#x8BAD;&#x7EC3;&#x6A21;&#x578B;</li>
<li>caffe&#x7684;&#x4F9D;&#x8D56;&#x4F1A;&#x5728;&#x811A;&#x672C;&#x4E2D;&#x5B89;&#x88C5;&#xFF0C;&#x4F46;&#x6709;&#x4E9B;Debian&#x517C;&#x5BB9;&#x95EE;&#x9898;&#x8981;&#x89E3;&#x51B3;</li>
<li>&#x5F00;&#x542F;CUDA&#x652F;&#x6301;&#x540E;&#xFF0C;&#x7F16;&#x8BD1;caffe&#x4F1A;&#x627E;&#x4E0D;&#x5230;libboost-python3&#xFF0C;&#x56E0;&#x4E3A;&#x5728;Ubuntu16.04&#x91CC;&#xFF0C;&#x5B83;&#x53EB;libboost-python3.5&#xFF0C;&#x6240;&#x4EE5;&#x8981;&#x8F6F;&#x94FE;&#x63A5;&#x4E00;&#x4E0B;&#xFF1A;</li>
</ul>
</li>
</ul>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> /usr/lib/x86_64-linux-gnu/
sudo ln <span class="hljs-_">-s</span> libboost_python-py35.so libboost_python3.so
</code></pre>
<ul>
<li>&#x5176;&#x4ED6;&#x53EF;&#x80FD;&#x51FA;&#x73B0;&#x7684;caffe&#x7684;&#x5751;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x6211;<a href="https://github.com/ahangchen/windy-afternoon/blob/master/linux/note.md#caffe%E5%AE%98%E7%BD%91%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B%E6%B2%A1%E5%91%8A%E8%AF%89%E4%BD%A0%E7%9A%84%E4%B8%9C%E8%A5%BF" target="_blank">&#x535A;&#x5BA2;</a>&#x627E;&#x627E;&#x7B54;&#x6848;&#xFF0C;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x7684;&#x8BDD;&#xFF0C;&#x5C31;&#x53BB;caffe&#x7684;GitHub issue&#x641C;&#x5427;</li>
</ul>
<h4 id="&#x6D4B;&#x8BD5;">&#x6D4B;&#x8BD5;</h4>
<p>&#x4E00;&#x6CE2;&#x64CD;&#x4F5C;&#x4E4B;&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x88C5;&#x597D;&#x4E86;ncsdk&#x7F16;&#x8BD1;&#x6A21;&#x5757;&#xFF0C;&#x53EF;&#x4EE5;&#x4E0B;&#x8F7D;&#x6211;&#x8BAD;&#x7EC3;&#x7684;caffe&#x6A21;&#x578B;&#xFF0C;&#x5C1D;&#x8BD5;&#x7F16;&#x8BD1;&#x6210;ncs graph</p>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> https://github.com/ahangchen/MobileNetSSD
mvNCCompile example/MobileNetSSD_deploy.prototxt -w MobileNetSSD_deploy.caffemodel <span class="hljs-_">-s</span> 12 -is 300 300 -o ncs_mobilenet_ssd_graph
</code></pre>
<p>&#x8FD9;&#x91CC;&#x5176;&#x5B9E;&#x662F;&#x8C03;&#x7528;python3&#x53BB;&#x6267;&#x884C;/usr/local/bin/ncsdk/mvNCCompile.py&#x8FD9;&#x4E2A;&#x6587;&#x4EF6;&#xFF0C; &#x4E0D;&#x51FA;&#x610F;&#x5916;&#x5728;&#x5F53;&#x524D;&#x7248;&#x672C;&#xFF08;1.12.00&#xFF09;&#x4F60;&#x4F1A;&#x9047;&#x5230;&#x8FD9;&#x4E2A;&#x9519;&#x8BEF;&#xFF1A;</p>
<pre><code class="lang-bash">[Error 17] Toolkit Error: Internal Error: Could not build graph. Missing link: conv11_mbox_conf
</code></pre>
<p>&#x8FD9;&#x662F;&#x56E0;&#x4E3A;NCSDK&#x5728;&#x5904;&#x7406;caffe&#x6A21;&#x578B;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4F1A;&#x628A;conv11_mbox_conf_new&#x8282;&#x70B9;&#x53EB;&#x505A;conv11_mbox_conf&#xFF0C;&#x6240;&#x4EE5;build graph&#x7684;&#x65F6;&#x5019;&#x5C31;&#x4F1A;&#x627E;&#x4E0D;&#x7740;&#x3002;&#x56E0;&#x6B64;&#x9700;&#x8981;&#x4E3A;&#x8FD9;&#x79CD;&#x8282;&#x70B9;&#x8D77;&#x4E00;&#x4E2A;&#x522B;&#x540D;&#xFF0C;&#x5373;&#xFF0C;&#x5C06;conv11_mbox_conf_new&#x8D77;&#x522B;&#x540D;&#x4E3A;conv11_mbox_conf&#xFF0C;&#x4FEE;&#x6539;SDK&#x4EE3;&#x7801;&#x4E2D;&#x7684;/usr/local/bin/ncsdk/Models/NetworkStage.py&#xFF0C;&#x5728;&#x7B2C;85&#x884C;&#x540E;&#x9762;&#x6DFB;&#x52A0;&#xFF1A;</p>
<pre><code class="lang-python">if &apos;&apos;_new&apos; in name:
    self.alias.append(name[:-4])
</code></pre>
<p>&#x4E8E;&#x662F;&#x5C31;&#x80FD;&#x7F16;&#x8BD1;&#x751F;&#x6210;graph&#x4E86;&#xFF0C;&#x4F60;&#x4F1A;&#x770B;&#x5230;&#x4E00;&#x4E2A;&#x540D;&#x4E3A;ncs_mobilenet_ssd_graph&#x7684;&#x6587;&#x4EF6;&#x3002;</p>
<p>&#x4E0A;&#x8FB9;&#x8FD9;&#x4E2A;bug&#x6211;&#x5DF2;&#x7ECF;&#x8DDF;NCSDK&#x7684;&#x5DE5;&#x7A0B;&#x5E08;&#x8BB2;&#x4E86;&#xFF0C;&#x4ED6;&#x4EEC;&#x5728;&#x8DDF;&#x8FDB;&#x4FEE;&#x8FD9;&#x4E2A;bug&#xFF1A;
<img src="https://upload-images.jianshu.io/upload_images/1828517-0339d113ef259dbb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="NCS bug"></p>
<h3 id="&#x6D4B;&#x8BD5;&#x7AEF;">&#x6D4B;&#x8BD5;&#x7AEF;</h3>
<h4 id="ncsdk">NCSDK</h4>
<p>&#x6D4B;&#x8BD5;&#x7AEF;&#x8981;&#x5B89;&#x88C5;ncsdk python api&#xFF0C;&#x7528;&#x4E8E;inference&#xFF0C;&#x5B9E;&#x9645;&#x4E0A;&#x6D4B;&#x8BD5;&#x7AEF;&#x80FD;&#x505A;&#x7684;&#x64CD;&#x4F5C;&#xFF0C;&#x8BAD;&#x7EC3;&#x7AEF;&#x4E5F;&#x90FD;&#x80FD;&#x505A;</p>
<pre><code>git clone https://github.com/movidius/ncsdk
cd api/src
make install
</code></pre><p>&#x4ECE;&#x8F93;&#x51FA;&#x65E5;&#x5FD7;&#x53EF;&#x4EE5;&#x53D1;&#x73B0;&#xFF0C;&#x5C06;ncsdk&#x7684;lib&#x548C;include&#x6587;&#x4EF6;&#x5206;&#x522B;&#x548C;&#x7CFB;&#x7EDF;&#x7684;python2&#xFF08;/usr/bin/python2&#xFF09;&#x548C;python3(/usr/bin/python3)&#x505A;&#x4E86;&#x5173;&#x8054;&#x3002;</p>
<p>&#x7136;&#x540E;&#x4F60;&#x53EF;&#x4EE5;&#x4E0B;&#x4E00;&#x4E2A;GitHub&#x5DE5;&#x7A0B;&#x6765;&#x8DD1;&#x4E00;&#x4E9B;&#x6D4B;&#x8BD5;&#xFF1A;</p>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> https://github.com/movidius/ncappzoo
<span class="hljs-built_in">cd</span> ncappzoo/apps/hello_ncs_py
python3 hello_ncs.py
python2 hello_ncs.py
</code></pre>
<p>&#x6CA1;&#x62A5;&#x9519;&#x5C31;&#x662F;&#x88C5;&#x597D;&#x4E86;&#xFF0C;&#x6D4B;&#x8BD5;&#x7AEF;&#x5F88;&#x7B80;&#x5355;&#x3002;</p>
<h4 id="opencv">OpenCV</h4>
<p>&#x770B;pyimagesearch&#x8FD9;&#x4E2A;<a href="https://www.pyimagesearch.com/2017/09/04/raspbian-stretch-install-opencv-3-python-on-your-raspberry-pi/" target="_blank">&#x6559;&#x7A0B;</a></p>
<h2 id="caffe&#x6A21;&#x578B;&#x8BAD;&#x7EC3;">Caffe&#x6A21;&#x578B;&#x8BAD;&#x7EC3;</h2>
<p>&#x5C31;&#x662F;&#x6B63;&#x5E38;&#x7684;&#x7528;caffe&#x8BAD;&#x7EC3;MobileNet-SSD&#xFF0C;&#x4E3B;&#x8981;&#x53C2;&#x8003;&#x8FD9;&#x4E2A;&#x4ED3;&#x5E93;&#xFF1A;</p>
<ul>
<li>MobileNet-SSD: <a href="https://github.com/chuanqi305/MobileNet-SSD" target="_blank">https://github.com/chuanqi305/MobileNet-SSD</a></li>
</ul>
<p>README&#x91CC;&#x5C06;&#x6B65;&#x9AA4;&#x8BB2;&#x5F97;&#x5F88;&#x6E05;&#x695A;&#x4E86;</p>
<ol>
<li>&#x4E0B;&#x8F7D;SSD-caffe&#xFF08;&#x8FD9;&#x4E2A;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x5728;NCSDK&#x91CC;&#x88C5;&#x4E86;&#xFF09;</li>
<li>&#x4E0B;&#x8F7D;chuanqi&#x5728;VOC0712&#x4E0A;&#x9884;&#x8BAD;&#x7EC3;&#x7684;<a href="https://drive.google.com/open?id=0B3gersZ2cHIxVFI1Rjd5aDgwOG8" target="_blank">&#x6A21;&#x578B;</a></li>
<li>&#x628A;MobileNet-SSD&#x8FD9;&#x4E2A;&#x9879;&#x76EE;&#x653E;&#x5230;SSD-Caffe&#x7684;examples&#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x8FD9;&#x4E00;&#x6B65;&#x53EF;&#x4EE5;&#x4E0D;&#x505A;&#xFF0C;&#x4F46;&#x662F;&#x8981;&#x5BF9;&#x5E94;&#x4FEE;&#x6539;train.sh&#x91CC;&#x7684;caffe&#x76EE;&#x5F55;&#x4F4D;&#x7F6E;</li>
<li>&#x521B;&#x5EFA;&#x4F60;&#x81EA;&#x5DF1;&#x7684;<code>labelmap.prototxt</code>&#xFF0C;&#x653E;&#x5230;MobileNet-SSD&#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x6BD4;&#x5982;&#x8BF4;&#xFF0C;&#x4F60;&#x662F;&#x5728;coco&#x9884;&#x8BAD;&#x7EC3;&#x6A21;&#x578B;&#x4E0A;&#x8BAD;&#x7EC3;&#x7684;&#x8BDD;&#xFF0C;&#x53EF;&#x4EE5;&#x628A;<a href="https://github.com/weiliu89/caffe/blob/ssd/data/coco/labelmap_coco.prototxt" target="_blank">coco&#x7684;&#x6807;&#x7B7E;&#x6587;&#x4EF6;</a>&#x590D;&#x5236;&#x8FC7;&#x6765;&#xFF0C;&#x5C06;&#x5176;&#x4E2D;&#x4E0E;&#x4F60;&#x7684;&#x76EE;&#x6807;&#x7C7B;&#xFF08;&#x6BD4;&#x5982;&#x6211;&#x7684;&#x76EE;&#x6807;&#x7C7B;&#x662F;Cattle&#xFF09;&#x76F8;&#x8FD1;&#x7684;&#x7C7B;&#xFF08;&#x6BD4;&#x5982;Coco&#x4E2D;&#x662F;Cow&#xFF09;&#x6539;&#x6210;&#x5BF9;&#x5E94;&#x7684;&#x540D;&#x5B57;&#xFF0C;&#x5E76;&#x7528;&#x5B83;&#x7684;label&#x4F5C;&#x4E3A;&#x4F60;&#x7684;&#x76EE;&#x6807;&#x7C7B;&#x7684;label&#x3002;&#xFF08;&#x6BD4;&#x5982;&#x6211;&#x7528;21&#x8FD9;&#x4E2A;&#x7C7B;&#x4EE3;&#x8868;Cattle&#xFF09;</li>
<li>&#x7528;&#x4F60;&#x81EA;&#x5DF1;&#x7684;&#x6570;&#x636E;&#x8BAD;&#x7EC3;MobileNet-SSD&#xFF0C;&#x53C2;&#x8003;SSD-caffe&#x7684;<a href="https://github.com/weiliu89/caffe/wiki/Train-SSD-on-custom-dataset" target="_blank">wiki</a>&#xFF0C;&#x4E3B;&#x8981;&#x601D;&#x8DEF;&#x8FD8;&#x662F;&#x628A;&#x4F60;&#x7684;&#x6570;&#x636E;&#x8F6C;&#x6362;&#x6210;&#x7C7B;&#x4F3C;VOC&#x6216;&#x8005;COCO&#x7684;&#x683C;&#x5F0F;&#xFF0C;&#x7136;&#x540E;&#x751F;&#x6210;lmdb&#xFF0C;&#x5751;&#x4E5F;&#x633A;&#x591A;&#x7684;&#xFF1A;</li>
<li>&#x5047;&#x8BBE;&#x4F60;&#x7684;&#x6253;&#x7684;&#x6807;&#x7B7E;&#x662F;&#x8FD9;&#x6837;&#x4E00;&#x4E2A;&#x6587;&#x4EF6;<code>raw_label.txt</code>&#xFF0C;&#x5047;&#x88C5;&#x6211;&#x4EEC;&#x6570;&#x636E;&#x96C6;&#x53EA;&#x6709;&#x4E24;&#x5F20;&#x56FE;&#x7247;&#xFF1A;</li>
</ol>
<pre><code>data/strange_animal/1017.jpg 0.487500    0.320675    0.670000    0.433193
data/strange_animal/1018.jpg 0.215000    0.293952    0.617500    0.481013
</code></pre><ul>
<li><p>&#x6211;&#x4EEC;&#x7684;&#x76EE;&#x6807;&#x662F;&#x5C06;&#x6807;&#x7B7E;&#x4E2D;&#x6D89;&#x53CA;&#x7684;<code>&#x56FE;&#x7247;&#x548C;&#x4F4D;&#x7F6E;&#x4FE1;&#x606F;</code>&#x8F6C;&#x6210;&#x8FD9;&#x6837;&#x4E00;&#x4E2A;&#x76EE;&#x5F55;&#xFF08;&#x5728;ssd-caffe/data/coco&#x76EE;&#x5F55;&#x57FA;&#x7840;&#x4E0A;&#x751F;&#x6210;&#x7684;&#xFF09;&#xFF1A;</p>
<pre><code>coco_cattle
&#x251C;&#x2500;&#x2500; all # &#x5B58;&#x653E;&#x5168;&#x90E8;&#x56FE;&#x7247;&#x548C;xml&#x6807;&#x7B7E;&#x6587;&#x4EF6;
&#x2502;   &#x251C;&#x2500;&#x2500; 1017.jpg
&#x2502;   &#x251C;&#x2500;&#x2500; 1017.xml
&#x2502;   &#x251C;&#x2500;&#x2500; 1018.jpg
&#x2502;   &#x2514;&#x2500;&#x2500; 1018.xml
&#x251C;&#x2500;&#x2500; Annotations # &#x5B58;&#x653E;&#x5168;&#x90E8;&#x6807;&#x7B7E;xml
&#x2502;   &#x251C;&#x2500;&#x2500; 1017.xml
&#x2502;   &#x2514;&#x2500;&#x2500; 1018.xml
&#x251C;&#x2500;&#x2500; create_data.sh # &#x5C06;&#x56FE;&#x7247;&#x8F6C;&#x4E3A;lmdb&#x7684;&#x811A;&#x672C;
&#x251C;&#x2500;&#x2500; create_list.py # &#x6839;&#x636E;ImageSets&#x91CC;&#x7684;&#x6570;&#x636E;&#x96C6;&#x5212;&#x5206;&#x6587;&#x4EF6;&#xFF0C;&#x751F;&#x6210;jpg&#x548C;xml&#x7684;&#x5BF9;&#x5E94;&#x5173;&#x7CFB;&#x6587;&#x4EF6;&#x5230;coco_cattle&#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x4F46;&#x6211;&#x53D1;&#x73B0;&#x8FD9;&#x4E2A;&#x5BF9;&#x5E94;&#x5173;&#x7CFB;&#x6587;&#x4EF6;&#x7528;&#x4E0D;&#x4E0A;
&#x251C;&#x2500;&#x2500; images  # &#x5B58;&#x653E;&#x5168;&#x90E8;&#x56FE;&#x7247;
&#x2502;   &#x251C;&#x2500;&#x2500; 1017.jpg
&#x2502;   &#x2514;&#x2500;&#x2500; 1018.jpg
&#x251C;&#x2500;&#x2500; ImageSets # &#x5212;&#x5206;&#x8BAD;&#x7EC3;&#x96C6;&#xFF0C;&#x9A8C;&#x8BC1;&#x96C6;&#x548C;&#x6D4B;&#x8BD5;&#x96C6;&#x7B49;&#xFF0C;&#x5982;&#x679C;&#x53EA;&#x60F3;&#x5206;&#x8BAD;&#x7EC3;&#x548C;&#x9A8C;&#x8BC1;&#x7684;&#x8BDD;&#xFF0C;&#x53EF;&#x4EE5;&#x628A;minival.txt,testdev.txt,test.txt&#x5185;&#x5BB9;&#x6539;&#x6210;&#x4E00;&#x6837;&#x7684;
&#x2502;   &#x251C;&#x2500;&#x2500; minival.txt 
&#x2502;   &#x251C;&#x2500;&#x2500; testdev.txt
&#x2502;   &#x251C;&#x2500;&#x2500; test.txt
&#x2502;   &#x2514;&#x2500;&#x2500; train.txt
&#x251C;&#x2500;&#x2500; labelmap_coco.prototxt # &#x5982;&#x524D;&#x6240;&#x8FF0;&#x7684;&#x6807;&#x7B7E;&#x6587;&#x4EF6;&#xFF0C;&#x6539;&#x4E00;&#x4E0B;&#x53EF;&#x4EE5;&#x653E;&#x5230;MobileNet-SSD&#x76EE;&#x5F55;&#x4E0B;
&#x251C;&#x2500;&#x2500; labels.txt
&#x251C;&#x2500;&#x2500; lmdb # &#x624B;&#x52A8;&#x521B;&#x5EFA;&#x8FD9;&#x4E2A;&#x76EE;&#x5F55;
&#x2502;   &#x251C;&#x2500;&#x2500; coco_cattle_minival_lmdb # &#x81EA;&#x52A8;&#x521B;&#x5EFA;&#x7684;&#xFF0C;&#x7531;&#x56FE;&#x7247;&#x548C;&#x6807;&#x7B7E;&#x8F6C;&#x6362;&#x6765;&#x7684;LMDB&#x6587;&#x4EF6;
&#x2502;   &#x251C;&#x2500;&#x2500; coco_cattle_testdev_lmdb
&#x2502;   &#x251C;&#x2500;&#x2500; coco_cattle_test_lmdb
&#x2502;   &#x2514;&#x2500;&#x2500; coco_cattle_train_lmdb
&#x251C;&#x2500;&#x2500; minival.log
&#x251C;&#x2500;&#x2500; README.md
&#x251C;&#x2500;&#x2500; testdev.log
&#x251C;&#x2500;&#x2500; test.log
&#x2514;&#x2500;&#x2500; train.log
</code></pre></li>
<li><p>&#x5176;&#x4E2D;&#xFF0C;&#x6807;&#x7B7E;xml&#x7684;&#x683C;&#x5F0F;&#x5982;&#x4E0B;&#xFF1A;</p>
</li>
</ul>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">annotation</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">folder</span>&gt;</span>train<span class="hljs-tag">&lt;/<span class="hljs-name">folder</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">filename</span>&gt;</span>86<span class="hljs-tag">&lt;/<span class="hljs-name">filename</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">source</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">database</span>&gt;</span>coco_cattle<span class="hljs-tag">&lt;/<span class="hljs-name">database</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">source</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">size</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">width</span>&gt;</span>720<span class="hljs-tag">&lt;/<span class="hljs-name">width</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">height</span>&gt;</span>1280<span class="hljs-tag">&lt;/<span class="hljs-name">height</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">depth</span>&gt;</span>3<span class="hljs-tag">&lt;/<span class="hljs-name">depth</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">size</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">segmented</span>&gt;</span>0<span class="hljs-tag">&lt;/<span class="hljs-name">segmented</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">object</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>21<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">pose</span>&gt;</span>Unspecified<span class="hljs-tag">&lt;/<span class="hljs-name">pose</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">truncated</span>&gt;</span>0<span class="hljs-tag">&lt;/<span class="hljs-name">truncated</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">difficult</span>&gt;</span>0<span class="hljs-tag">&lt;/<span class="hljs-name">difficult</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">bndbox</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">xmin</span>&gt;</span>169<span class="hljs-tag">&lt;/<span class="hljs-name">xmin</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">ymin</span>&gt;</span>388<span class="hljs-tag">&lt;/<span class="hljs-name">ymin</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">xmax</span>&gt;</span>372<span class="hljs-tag">&lt;/<span class="hljs-name">xmax</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">ymax</span>&gt;</span>559<span class="hljs-tag">&lt;/<span class="hljs-name">ymax</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">bndbox</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">object</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">object</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">name</span>&gt;</span>21<span class="hljs-tag">&lt;/<span class="hljs-name">name</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">pose</span>&gt;</span>Unspecified<span class="hljs-tag">&lt;/<span class="hljs-name">pose</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">truncated</span>&gt;</span>0<span class="hljs-tag">&lt;/<span class="hljs-name">truncated</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">difficult</span>&gt;</span>0<span class="hljs-tag">&lt;/<span class="hljs-name">difficult</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">bndbox</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">xmin</span>&gt;</span>169<span class="hljs-tag">&lt;/<span class="hljs-name">xmin</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">ymin</span>&gt;</span>388<span class="hljs-tag">&lt;/<span class="hljs-name">ymin</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">xmax</span>&gt;</span>372<span class="hljs-tag">&lt;/<span class="hljs-name">xmax</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">ymax</span>&gt;</span>559<span class="hljs-tag">&lt;/<span class="hljs-name">ymax</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">bndbox</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">object</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">annotation</span>&gt;</span>
</code></pre>
<p>&#x4EE3;&#x8868;&#x4E00;&#x5F20;&#x56FE;&#x4E2D;&#x591A;&#x4E2A;&#x5BF9;&#x8C61;&#x6240;&#x5728;&#x4F4D;&#x7F6E;&#xFF08;bndbox&#x8282;&#x70B9;&#x8868;&#x793A;&#xFF09;&#xFF0C;&#x4EE5;&#x53CA;&#x7C7B;&#x522B;&#xFF08;name&#xFF09;&#x3002;</p>
<ul>
<li>&#x4E00;&#x5F00;&#x59CB;&#xFF0C;<code>all</code>, <code>Annotations</code>, <code>images</code>, <code>ImageSets</code>,<code>lmdb</code>&#x56DB;&#x4E2A;&#x76EE;&#x5F55;&#x90FD;&#x662F;&#x7A7A;&#x7684;&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x628A;&#x81EA;&#x5DF1;&#x7684;&#x56FE;&#x7247;&#x653E;&#x5230;&#x968F;&#x4FBF;&#x54EA;&#x4E2A;&#x5730;&#x65B9;&#xFF0C;&#x53EA;&#x8981;&#x5728;raw_label.txt&#x91CC;&#x5199;&#x597D;&#x56FE;&#x7247;&#x8DEF;&#x5F84;&#x5C31;&#x884C;</li>
<li><p>&#x8BFB;&#x53D6;<code>raw_label.txt</code>&#xFF0C;&#x5229;&#x7528;<code>lxml</code>&#x6784;&#x9020;&#x4E00;&#x68F5;dom tree&#xFF0C;&#x7136;&#x540E;&#x5199;&#x5230;<code>Annotations</code>&#x5BF9;&#x5E94;&#x7684;xml&#x91CC;&#xFF0C;&#x5E76;&#x5C06;&#x5BF9;&#x5E94;&#x7684;&#x56FE;&#x7247;&#x79FB;&#x52A8;&#x5230;<code>image</code>&#x76EE;&#x5F55;&#x91CC;&#xFF0C;&#x53EF;&#x4EE5;&#x53C2;&#x8003;<a href="https://gist.github.com/ahangchen/ae1b7562c1f93fdad1de58020e94fbdf" target="_blank">&#x8FD9;&#x4EFD;&#x4EE3;&#x7801;</a>&#x3002;&#x5E76;&#x6839;&#x636E;&#x6211;&#x4EEC;&#x8BBE;&#x7F6E;&#x7684;train or not&#x6807;&#x5FD7;&#x7B26;&#x5C06;&#x5F53;&#x524D;&#x8FD9;&#x5F20;&#x56FE;&#x7247;&#x5206;&#x914D;&#x5230;&#x8BAD;&#x7EC3;&#x96C6;&#x6216;&#x6D4B;&#x8BD5;&#x96C6;&#x4E2D;&#xFF08;&#x4E5F;&#x5C31;&#x662F;&#x5F80;ImageSet/train.txt&#x4E2D;&#x5199;&#x5BF9;&#x5E94;&#x7684;&#x56FE;&#x7247;&#x540D;&#xFF09;</p>
</li>
<li><p>&#x8FD9;&#x6837;&#x4E00;&#x6CE2;&#x64CD;&#x4F5C;&#x4E4B;&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x7684;<code>images</code>&#x548C;<code>Annotations</code>&#x76EE;&#x5F55;&#x91CC;&#x90FD;&#x4F1A;&#x6709;&#x6570;&#x636E;&#x4E86;&#xFF0C;&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x628A;&#x5B83;&#x4EEC;&#x4E00;&#x5757;&#x590D;&#x5236;&#x5230;<code>all</code>&#x76EE;&#x5F55;&#x4E0B;</p>
</li>
</ul>
<pre><code class="lang-shell">cp images/* all/
cp Annotations/* all/
</code></pre>
<ul>
<li>&#x7136;&#x540E;&#x7528;create_data.sh&#x5C06;<code>all</code>&#x4E2D;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x6839;&#x636E;<code>ImageSet</code>&#x4E2D;&#x7684;&#x6570;&#x636E;&#x96C6;&#x5212;&#x5206;&#xFF0C;&#x521B;&#x5EFA;&#x8BAD;&#x7EC3;&#x96C6;&#x548C;&#x6D4B;&#x8BD5;&#x96C6;&#x7684;lmdb&#xFF0C;&#x8FD9;&#x91CC;&#x5BF9;coco&#x7684;create_data.sh&#x505A;&#x4E86;&#x4E00;&#x70B9;&#x4FEE;&#x6539;&#xFF1A;</li>
</ul>
<pre><code class="lang-bash">cur_dir=$(<span class="hljs-built_in">cd</span> $( dirname <span class="hljs-variable">${BASH_SOURCE[0]}</span> ) &amp;&amp; <span class="hljs-built_in">pwd</span> )
root_dir=<span class="hljs-variable">$cur_dir</span>/../..

<span class="hljs-built_in">cd</span> <span class="hljs-variable">$root_dir</span>

redo=<span class="hljs-literal">true</span>
<span class="hljs-comment"># &#x8FD9;&#x91CC;&#x6539;&#x6210;all&#x76EE;&#x5F55;</span>
data_root_dir=<span class="hljs-string">&quot;<span class="hljs-variable">$cur_dir</span>/all&quot;</span>
<span class="hljs-comment"># &#x8FD9;&#x91CC;&#x6539;&#x6210;&#x81EA;&#x5DF1;&#x7684;&#x6570;&#x636E;&#x96C6;&#x540D;&#xFF0C;&#x4E5F;&#x662F;&#x6211;&#x4EEC;&#x8FD9;&#x4E2A;&#x76EE;&#x5F55;&#x7684;&#x540D;&#x5B57;</span>
dataset_name=<span class="hljs-string">&quot;coco_cattle&quot;</span>
<span class="hljs-comment"># &#x6307;&#x5B9A;&#x6807;&#x7B7E;&#x6587;&#x4EF6;</span>
<span class="hljs-built_in">mapfile</span>=<span class="hljs-string">&quot;<span class="hljs-variable">$root_dir</span>/data/<span class="hljs-variable">$dataset_name</span>/labelmap_coco.prototxt&quot;</span>
anno_<span class="hljs-built_in">type</span>=<span class="hljs-string">&quot;detection&quot;</span>
label_<span class="hljs-built_in">type</span>=<span class="hljs-string">&quot;xml&quot;</span>
db=<span class="hljs-string">&quot;lmdb&quot;</span>
min_dim=0
max_dim=0
width=0
height=0

extra_cmd=<span class="hljs-string">&quot;--encode-type=jpg --encoded&quot;</span>
<span class="hljs-keyword">if</span> <span class="hljs-variable">$redo</span>
<span class="hljs-keyword">then</span>
  extra_cmd=<span class="hljs-string">&quot;<span class="hljs-variable">$extra_cmd</span> --redo&quot;</span>
<span class="hljs-keyword">fi</span>
<span class="hljs-keyword">for</span> subset <span class="hljs-keyword">in</span> minival testdev train <span class="hljs-built_in">test</span>
<span class="hljs-keyword">do</span>
  python3 <span class="hljs-variable">$root_dir</span>/scripts/create_annoset.py --anno-type=<span class="hljs-variable">$anno_type</span> --label-type=<span class="hljs-variable">$label_type</span> --label-map-file=<span class="hljs-variable">$mapfile</span> --min-dim=<span class="hljs-variable">$min_dim</span> --max-dim=<span class="hljs-variable">$max_dim</span> --resize-width=<span class="hljs-variable">$width</span> --resize-height=<span class="hljs-variable">$height</span> --check-label <span class="hljs-variable">$extra_cmd</span> <span class="hljs-variable">$data_root_dir</span> <span class="hljs-variable">$root_dir</span>/data/<span class="hljs-variable">$dataset_name</span>/ImageSets/<span class="hljs-variable">$subset</span>.txt <span class="hljs-variable">$data_root_dir</span>/../<span class="hljs-variable">$db</span>/<span class="hljs-variable">$dataset_name</span><span class="hljs-string">&quot;_&quot;</span><span class="hljs-variable">$subset</span><span class="hljs-string">&quot;_&quot;</span><span class="hljs-variable">$db</span> examples/<span class="hljs-variable">$dataset_name</span> 2&gt;&amp;1 | tee <span class="hljs-variable">$root_dir</span>/data/<span class="hljs-variable">$dataset_name</span>/<span class="hljs-variable">$subset</span>.log
<span class="hljs-keyword">done</span>
</code></pre>
<p>&#x4E8E;&#x662F;&#x4F1A;lmdb&#x76EE;&#x5F55;&#x4E0B;&#x4F1A;&#x4E3A;&#x6BCF;&#x4E2A;&#x5212;&#x5206;&#x96C6;&#x5408;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x76EE;&#x5F55;&#xFF0C;&#x5B58;&#x653E;&#x6570;&#x636E;</p>
<pre><code>&#x251C;&#x2500;&#x2500; lmdb
&#x2502;   &#x251C;&#x2500;&#x2500; coco_cattle_minival_lmdb
&#x2502;   &#x2502;   &#x251C;&#x2500;&#x2500; data.mdb
&#x2502;   &#x2502;   &#x2514;&#x2500;&#x2500; lock.mdb
&#x2502;   &#x251C;&#x2500;&#x2500; coco_cattle_testdev_lmdb
&#x2502;   &#x2502;   &#x251C;&#x2500;&#x2500; data.mdb
&#x2502;   &#x2502;   &#x2514;&#x2500;&#x2500; lock.mdb
&#x2502;   &#x251C;&#x2500;&#x2500; coco_cattle_test_lmdb
&#x2502;   &#x2502;   &#x251C;&#x2500;&#x2500; data.mdb
&#x2502;   &#x2502;   &#x2514;&#x2500;&#x2500; lock.mdb
&#x2502;   &#x2514;&#x2500;&#x2500; coco_cattle_train_lmdb
&#x2502;       &#x251C;&#x2500;&#x2500; data.mdb
&#x2502;       &#x2514;&#x2500;&#x2500; lock.mdb
</code></pre><ol>
<li>&#x5C06;5&#x751F;&#x6210;&#x7684;lmdb&#x94FE;&#x63A5;&#x5230;MobileNet-SSD&#x7684;&#x76EE;&#x5F55;&#x4E0B;&#xFF1A;</li>
</ol>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> MobileNet-SSD
ln <span class="hljs-_">-s</span> PATH_TO_YOUR_TRAIN_LMDB trainval_lmdb
ln <span class="hljs-_">-s</span> PATH_TO_YOUR_TEST_LMDB <span class="hljs-built_in">test</span>_lmdb
</code></pre>
<ol>
<li>&#x8FD0;&#x884C;<code>gen_model.sh</code>&#x751F;&#x6210;&#x4E09;&#x4E2A;prototxt&#xFF08;train, test, deploy&#xFF09;</li>
</ol>
<pre><code># &#x9ED8;&#x8BA4;clone&#x4E0B;&#x6765;&#x7684;&#x76EE;&#x5F55;&#x662F;&#x6CA1;&#x6709;example&#x8FD9;&#x4E2A;&#x76EE;&#x5F55;&#x7684;&#xFF0C;&#x800C;gen_model.sh&#x53C8;&#x4F1A;&#x628A;&#x6587;&#x4EF6;&#x751F;&#x6210;&#x5230;example&#x76EE;&#x5F55;
mkdir example
./gen_model.sh
</code></pre><ol>
<li>&#x8BAD;&#x7EC3;<pre><code>./train.sh
</code></pre>&#x8FD9;&#x91CC;&#x5982;&#x679C;&#x7206;&#x663E;&#x5B58;&#x4E86;&#xFF0C;&#x53EF;&#x4EE5;&#x5230;<code>example/MobileNetSSD_train.prototxt</code>&#x4FEE;&#x6539;batch size&#xFF0C;&#x5047;&#x5982;&#x4F60;batch size&#x6539;&#x5230;20&#xFF0C;&#x521A;&#x597D;&#x53EF;&#x4EE5;&#x5403;&#x6EE1;GTX1060&#x7684;6G&#x663E;&#x5B58;&#xFF0C;&#x4F46;&#x662F;&#x8DD1;&#x5230;&#x4E00;&#x5B9A;&#x6B65;&#x6570;&#xFF08;&#x8BBE;&#x7F6E;&#x5728;<code>solver_test.prototxt</code>&#x91CC;&#x7684;test_interval&#x53D8;&#x91CF;&#xFF09;&#xFF0C;&#x4F1A;&#x6267;&#x884C;&#x53E6;&#x4E00;&#x4E2A;&#x5C0F;batch&#x7684;test&#xFF08;&#x8FD9;&#x4E2A;batch size&#x5B9A;&#x4E49;&#x5728;<code>example/MobileNetSSD_test.prototxt</code>&#x91CC;&#xFF09;&#xFF0C;&#x8FD9;&#x6837;&#x5C31;&#x4F1A;&#x518D;&#x7206;&#x663E;&#x5B58;&#xFF0C;&#x6240;&#x4EE5;&#x5982;&#x679C;&#x4F60;&#x7684;<code>train_batch_size + test_batch_size &lt;= 20</code>&#x7684;&#x8BDD;&#x624D;&#x53EF;&#x4EE5;&#x4FDD;&#x8BC1;&#x4F60;&#x5728;6G&#x663E;&#x5B58;&#x4E0A;&#x80FD;&#x987A;&#x5229;&#x5B8C;&#x6210;&#x8BAD;&#x7EC3;&#xFF0C;&#x6211;&#x7684;&#x8BBE;&#x7F6E;&#x662F;<code>train_batch_size=16, test_batch_size=4</code></li>
</ol>
<p>&#x4E00;&#x5F00;&#x59CB;&#x7684;training loss&#x53EF;&#x80FD;&#x6BD4;&#x8F83;&#x5927;&#xFF0C;30&#x5DE6;&#x53F3;&#xFF0C;&#x7B49;&#x5230;loss&#x4E0B;&#x964D;&#x5230;2.x&#x4E00;&#x6BB5;&#x65F6;&#x95F4;&#x5C31;&#x53EF;&#x4EE5;ctrl+c&#x9000;&#x51FA;&#x8BAD;&#x7EC3;&#x4E86;&#xFF0C;&#x6A21;&#x578B;&#x6743;&#x91CD;&#x4F1A;&#x81EA;&#x52A8;&#x4FDD;&#x5B58;&#x5728;snapshot&#x76EE;&#x5F55;&#x4E0B;</p>
<ol>
<li><p>&#x8FD0;&#x884C;merge_bn.py&#x5C06;&#x8BAD;&#x7EC3;&#x5F97;&#x5230;&#x7684;&#x6A21;&#x578B;&#x53BB;&#x9664;bn&#x5C42;&#xFF0C;&#x5F97;&#x5230;&#x53EF;&#x90E8;&#x7F72;&#x7684;Caffe&#x6A21;&#x578B;&#xFF0C;&#x8FD9;&#x6837;&#x4F60;&#x5C31;&#x80FD;&#x5F97;&#x5230;&#x4E00;&#x4E2A;&#x540D;&#x4E3A;<code>MobileNetSSD_deploy.caffemodel</code>&#x7684;&#x6743;&#x91CD;&#x6587;&#x4EF6;&#xFF0C;&#x5BF9;&#x5E94;&#x7684;prototxt&#x4E3A;<code>example/MobileNetSSD_deploy.prototxt</code></p>
</li>
<li><p>&#x79BB;&#x9898;&#x90A3;&#x4E48;&#x4E45;&#xFF0C;&#x7EC8;&#x4E8E;&#x6765;&#x5230;&#x4E3B;&#x9898;&#xFF0C;&#x6211;&#x4EEC;&#x8981;&#x628A;&#x8FD9;&#x4E2A;caffemodel&#x7F16;&#x8BD1;&#x6210;NCS&#x53EF;&#x8FD0;&#x884C;&#x7684;graph&#xFF0C;&#x8FD9;&#x4E2A;&#x64CD;&#x4F5C;&#x4E4B;&#x524D;&#x5728;&#x642D;&#x73AF;&#x5883;&#x7684;&#x90E8;&#x5206;&#x4E5F;&#x63D0;&#x8FC7;&#xFF1A;</p>
</li>
</ol>
<pre><code>mvNCCompile example/MobileNetSSD_deploy.prototxt -w MobileNetSSD_deploy.caffemodel -s 12 -is 300 300 -o ncs_mobilenet_ssd_graph
</code></pre><p>&#x53C2;&#x6570;&#x683C;&#x5F0F;&#xFF1A;</p>
<pre><code class="lang-shell">mvNCCompile prototxt&#x8DEF;&#x5F84; -w &#x6743;&#x91CD;&#x6587;&#x4EF6;&#x8DEF;&#x5F84; -s &#x6700;&#x5927;&#x652F;&#x6301;&#x7684;NCS&#x6570;&#x76EE; -is &#x8F93;&#x5165;&#x56FE;&#x7247;&#x5BBD;&#x5EA6; &#x8F93;&#x5165;&#x56FE;&#x7247;&#x9AD8;&#x5EA6; -o &#x8F93;&#x51FA;graph&#x8DEF;&#x5F84;
</code></pre>
<p>&#x5176;&#x5B9E;&#x8BAD;&#x7EC3;&#x7AEF;&#x76F8;&#x5BF9;&#x4E8E;chuanqi&#x7684;MobileNet-SSD&#x6CA1;&#x5565;&#x6539;&#x52A8;&#xFF0C;&#x751A;&#x81F3;&#x8BAD;&#x7EC3;&#x53C2;&#x6570;&#x4E5F;&#x4E0D;&#x7528;&#x600E;&#x4E48;&#x6539;&#x52A8;&#xFF0C;&#x4E3B;&#x8981;&#x5DE5;&#x4F5C;&#x8FD8;&#x662F;&#x5728;&#x6570;&#x636E;&#x9884;&#x5904;&#x7406;&#x4E0A;&#xFF0C;&#x53EF;&#x4EE5;&#x53C2;&#x8003;&#x6211;&#x7684;<a href="https://gist.github.com/ahangchen/ae1b7562c1f93fdad1de58020e94fbdf" target="_blank">&#x9884;&#x5904;&#x7406;&#x4EE3;&#x7801;</a></p>
<h2 id="&#x6811;&#x8393;&#x6D3E;ncs&#x6A21;&#x578B;&#x6D4B;&#x8BD5;">&#x6811;&#x8393;&#x6D3E;NCS&#x6A21;&#x578B;&#x6D4B;&#x8BD5;</h2>
<p>&#x73B0;&#x5728;&#x6211;&#x4EEC;&#x8981;&#x7528;ncs&#x7248;&#x7684;ssd&#x6A21;&#x578B;&#x5728;&#x6811;&#x8393;&#x6D3E;&#x4E0A;&#x8FDB;&#x884C;&#x5BF9;&#x56FE;&#x7247;&#x505A;&#x68C0;&#x6D4B;&#xFF0C;&#x8FD9;&#x4E2A;&#x76EE;&#x6807;&#x4E00;&#x65E6;&#x8FBE;&#x6210;&#x6211;&#x4EEC;&#x81EA;&#x7136;&#x4E5F;&#x80FD;&#x5BF9;&#x89C6;&#x9891;&#x6216;&#x6444;&#x50CF;&#x5934;&#x6570;&#x636E;&#x8FDB;&#x884C;&#x68C0;&#x6D4B;&#x4E86;&#x3002;</p>
<h3 id="&#x4ED3;&#x5E93;&#x7ED3;&#x6784;"><a href="http://github.com/ahangchen/ncs_detection" target="_blank">&#x4ED3;&#x5E93;</a>&#x7ED3;&#x6784;</h3>
<pre><code>ncs_detection
&#x251C;&#x2500;&#x2500; data # &#x6807;&#x7B7E;&#x6587;&#x4EF6;
&#x2502;   &#x2514;&#x2500;&#x2500; mscoco_label_map.pbtxt
&#x251C;&#x2500;&#x2500; file_helper.py # &#x6587;&#x4EF6;&#x64CD;&#x4F5C;&#x8F85;&#x52A9;&#x51FD;&#x6570;
&#x251C;&#x2500;&#x2500; model # &#x8BAD;&#x7EC3;&#x597D;&#x7684;&#x6A21;&#x578B;&#x653E;&#x5728;&#x8FD9;&#x91CC;
&#x2502;   &#x251C;&#x2500;&#x2500; ncs_mobilenet_ssd_graph
&#x2502;   &#x2514;&#x2500;&#x2500; README.md
&#x251C;&#x2500;&#x2500; ncs_detection.py # &#x4E3B;&#x5165;&#x53E3;
&#x251C;&#x2500;&#x2500; object_detection # &#x6539;&#x4E86;&#x4E00;&#x4E0B;TF&#x7684;Object detection&#x5305;&#x4E2D;&#x7684;&#x5DE5;&#x5177;&#x7C7B;&#x6765;&#x7528;
&#x2502;   &#x251C;&#x2500;&#x2500; __init__.py
&#x2502;   &#x251C;&#x2500;&#x2500; protos
&#x2502;   &#x2502;   &#x251C;&#x2500;&#x2500; __init__.py
&#x2502;   &#x2502;   &#x251C;&#x2500;&#x2500; string_int_label_map_pb2.py
&#x2502;   &#x2502;   &#x2514;&#x2500;&#x2500; string_int_label_map.proto
&#x2502;   &#x2514;&#x2500;&#x2500; utils
&#x2502;       &#x251C;&#x2500;&#x2500; __init__.py
&#x2502;       &#x251C;&#x2500;&#x2500; label_map_util.py
&#x2502;       &#x2514;&#x2500;&#x2500; visualization_utils.py
&#x251C;&#x2500;&#x2500; r10 # &#x56FE;&#x7247;&#x6570;&#x636E;
&#x2502;   &#x251C;&#x2500;&#x2500; 00000120.jpg
&#x2502;   &#x251C;&#x2500;&#x2500; 00000133.jpg
&#x2502;   &#x251C;&#x2500;&#x2500; 00000160.jpg
&#x2502;   &#x251C;&#x2500;&#x2500; 00000172.jpg
&#x2502;   &#x251C;&#x2500;&#x2500; 00000192.jpg
&#x2502;   &#x251C;&#x2500;&#x2500; 00000204.jpg
&#x2502;   &#x251C;&#x2500;&#x2500; 00000220.jpg
&#x2502;   &#x2514;&#x2500;&#x2500; 00000236.jpg
&#x251C;&#x2500;&#x2500; README.md
&#x2514;&#x2500;&#x2500; total_cnt.txt
</code></pre><ul>
<li>&#x7531;&#x4E8E;&#x8FD9;&#x4E2A;&#x5DE5;&#x7A0B;&#x4E00;&#x5F00;&#x59CB;&#x662F;&#x7528;Tensorflow Object Detection API&#x505A;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x6539;&#x4E86;&#x5176;&#x4E2D;&#x7684;&#x51E0;&#x4E2A;&#x6587;&#x4EF6;&#x6765;&#x8BFB;&#x6807;&#x7B7E;&#x548C;&#x753B;&#x68C0;&#x6D4B;&#x6846;&#xFF0C;&#x5C06;&#x5176;&#x4E2D;&#x8DDF;tf&#x76F8;&#x5173;&#x7684;&#x4EE3;&#x7801;&#x53BB;&#x6389;&#x3002;</li>
<li>TF&#x7684;&#x56FE;&#x7247;IO&#x662F;&#x7528;pillow&#x505A;&#x7684;&#xFF0C;&#x5728;&#x6811;&#x8393;&#x6D3E;&#x4E0A;&#x901F;&#x5EA6;&#x5947;&#x6162;&#xFF0C;&#x5BF9;&#x4E00;&#x5F20;1280x720&#x7684;&#x56FE;&#x4F7F;&#x7528;Image&#x7684;get_data&#x8FD9;&#x4E2A;&#x51FD;&#x6570;&#x83B7;&#x53D6;&#x6570;&#x636E;&#x9700;&#x8981;7&#x79D2;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x6539;&#x6210;&#x4E86;OpenCV&#x6765;&#x505A;IO&#x3002;</li>
</ul>
<h3 id="&#x4EFB;&#x52A1;&#x76EE;&#x6807;">&#x4EFB;&#x52A1;&#x76EE;&#x6807;</h3>
<p>&#x68C0;&#x6D4B;<code>r10</code>&#x76EE;&#x5F55;&#x4E2D;&#x7684;&#x56FE;&#x7247;&#x4E2D;&#x7684;&#x5BF9;&#x8C61;&#xFF0C;&#x6807;&#x8BB0;&#x51FA;&#x6765;&#xFF0C;&#x5B58;&#x5230;<code>r10_tmp</code>&#x76EE;&#x5F55;&#x91CC;</p>
<h3 id="&#x6D41;&#x7A0B;">&#x6D41;&#x7A0B;</h3>
<ul>
<li>&#x51C6;&#x5907;&#x76EE;&#x6807;&#x76EE;&#x5F55;</li>
</ul>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">config_init</span><span class="hljs-params">(dataset_pref)</span>:</span>
    os.system(<span class="hljs-string">&apos;mkdir %s_tmp&apos;</span> % dataset_pref)
    os.system(<span class="hljs-string">&apos;rm %s_tmp/*&apos;</span> % dataset_pref)
</code></pre>
<ul>
<li>&#x6307;&#x5B9A;&#x6A21;&#x578B;&#x8DEF;&#x5F84;&#xFF0C;&#x6807;&#x7B7E;&#x4F4D;&#x7F6E;&#xFF0C;&#x7C7B;&#x522B;&#x603B;&#x6570;&#xFF0C;&#x6D4B;&#x8BD5;&#x56FE;&#x7247;&#x8DEF;&#x5F84;</li>
</ul>
<pre><code class="lang-python">PATH_TO_CKPT = <span class="hljs-string">&apos;model/ncs_mobilenet_ssd_graph&apos;</span>
PATH_TO_LABELS = os.path.join(<span class="hljs-string">&apos;data&apos;</span>, <span class="hljs-string">&apos;mscoco_label_map.pbtxt&apos;</span>)
NUM_CLASSES = <span class="hljs-number">81</span>
TEST_IMAGE_PATHS = [os.path.join(img_dir, <span class="hljs-string">&apos;%08d.jpg&apos;</span> % i) <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(start_index, end_index)]
</code></pre>
<ul>
<li>&#x53D1;&#x73B0;&#x5E76;&#x5C1D;&#x8BD5;&#x6253;&#x5F00;&#x795E;&#x7ECF;&#x8BA1;&#x7B97;&#x68D2;</li>
</ul>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">ncs_prepare</span><span class="hljs-params">()</span>:</span>
    print(<span class="hljs-string">&quot;[INFO] finding NCS devices...&quot;</span>)
    devices = mvnc.EnumerateDevices()

    <span class="hljs-keyword">if</span> len(devices) == <span class="hljs-number">0</span>:
        print(<span class="hljs-string">&quot;[INFO] No devices found. Please plug in a NCS&quot;</span>)
        quit()

    print(<span class="hljs-string">&quot;[INFO] found {} devices. device0 will be used. &quot;</span>
          <span class="hljs-string">&quot;opening device0...&quot;</span>.format(len(devices)))
    device = mvnc.Device(devices[<span class="hljs-number">0</span>])
    device.OpenDevice()
    <span class="hljs-keyword">return</span> device
</code></pre>
<ul>
<li>&#x5C06;NCS&#x6A21;&#x578B;&#x52A0;&#x8F7D;&#x5230;NCS&#x4E2D;</li>
</ul>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">graph_prepare</span><span class="hljs-params">(PATH_TO_CKPT, device)</span>:</span>
    print(<span class="hljs-string">&quot;[INFO] loading the graph file into RPi memory...&quot;</span>)
    <span class="hljs-keyword">with</span> open(PATH_TO_CKPT, mode=<span class="hljs-string">&quot;rb&quot;</span>) <span class="hljs-keyword">as</span> f:
        graph_in_memory = f.read()

    <span class="hljs-comment"># load the graph into the NCS</span>
    print(<span class="hljs-string">&quot;[INFO] allocating the graph on the NCS...&quot;</span>)
    detection_graph = device.AllocateGraph(graph_in_memory)
    <span class="hljs-keyword">return</span> detection_graph
</code></pre>
<ul>
<li>&#x51C6;&#x5907;&#x597D;&#x6807;&#x7B7E;&#x4E0E;&#x7C7B;&#x540D;&#x5BF9;&#x5E94;&#x5173;&#x7CFB;</li>
</ul>
<pre><code class="lang-python">category_index = label_prepare(PATH_TO_LABELS, NUM_CLASSES)
</code></pre>
<ul>
<li>&#x8BFB;&#x53D6;&#x56FE;&#x7247;&#xFF0C;&#x7531;&#x4E8E;Caffe&#x8BAD;&#x7EC3;&#x56FE;&#x7247;&#x91C7;&#x7528;&#x7684;&#x901A;&#x9053;&#x987A;&#x5E8F;&#x662F;RGB&#xFF0C;&#x800C;OpenCV&#x6A21;&#x578B;&#x901A;&#x9053;&#x987A;&#x5E8F;&#x662F;BGR&#xFF0C;&#x9700;&#x8981;&#x8F6C;&#x6362;&#x4E00;&#x4E0B;</li>
</ul>
<pre><code class="lang-python">image_np = cv2.imread(image_path)
image_np = cv2.cvtColor(image_np, cv2.COLOR_BGR2RGB)
</code></pre>
<ul>
<li>&#x4F7F;&#x7528;NCS&#x6A21;&#x578B;&#x4E3A;&#x8F93;&#x5165;&#x56FE;&#x7247;&#x63A8;&#x65AD;&#x76EE;&#x6807;&#x4F4D;&#x7F6E;</li>
</ul>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">predict</span><span class="hljs-params">(image, graph)</span>:</span>
    image = preprocess_image(image)
    graph.LoadTensor(image, <span class="hljs-keyword">None</span>)
    (output, _) = graph.GetResult()
    num_valid_boxes = output[<span class="hljs-number">0</span>]
    predictions = []
    <span class="hljs-keyword">for</span> box_index <span class="hljs-keyword">in</span> range(num_valid_boxes):
        base_index = <span class="hljs-number">7</span> + box_index * <span class="hljs-number">7</span>

        <span class="hljs-keyword">if</span> (<span class="hljs-keyword">not</span> np.isfinite(output[base_index]) <span class="hljs-keyword">or</span>
                <span class="hljs-keyword">not</span> np.isfinite(output[base_index + <span class="hljs-number">1</span>]) <span class="hljs-keyword">or</span>
                <span class="hljs-keyword">not</span> np.isfinite(output[base_index + <span class="hljs-number">2</span>]) <span class="hljs-keyword">or</span>
                <span class="hljs-keyword">not</span> np.isfinite(output[base_index + <span class="hljs-number">3</span>]) <span class="hljs-keyword">or</span>
                <span class="hljs-keyword">not</span> np.isfinite(output[base_index + <span class="hljs-number">4</span>]) <span class="hljs-keyword">or</span>
                <span class="hljs-keyword">not</span> np.isfinite(output[base_index + <span class="hljs-number">5</span>]) <span class="hljs-keyword">or</span>
                <span class="hljs-keyword">not</span> np.isfinite(output[base_index + <span class="hljs-number">6</span>])):
            <span class="hljs-keyword">continue</span>

        (h, w) = image.shape[:<span class="hljs-number">2</span>]
        x1 = max(<span class="hljs-number">0</span>, output[base_index + <span class="hljs-number">3</span>])
        y1 = max(<span class="hljs-number">0</span>, output[base_index + <span class="hljs-number">4</span>])
        x2 = min(w, output[base_index + <span class="hljs-number">5</span>])
        y2 = min(h, output[base_index + <span class="hljs-number">6</span>])
        pred_class = int(output[base_index + <span class="hljs-number">1</span>]) + <span class="hljs-number">1</span>
        pred_conf = output[base_index + <span class="hljs-number">2</span>]
        pred_boxpts = (y1, x1, y2, x2)

        prediction = (pred_class, pred_conf, pred_boxpts)
        predictions.append(prediction)

    <span class="hljs-keyword">return</span> predictions
</code></pre>
<p>&#x5176;&#x4E2D;&#xFF0C;&#x9996;&#x5148;&#x5C06;&#x56FE;&#x7247;&#x5904;&#x7406;&#x4E3A;Caffe&#x8F93;&#x5165;&#x683C;&#x5F0F;&#xFF0C;&#x7F29;&#x653E;&#x5230;300x300&#xFF0C;&#x51CF;&#x5747;&#x503C;&#xFF0C;&#x7F29;&#x653E;&#x5230;0-1&#x8303;&#x56F4;&#xFF0C;&#x8F6C;&#x6D6E;&#x70B9;&#x6570;</p>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">preprocess_image</span><span class="hljs-params">(input_image)</span>:</span>
    PREPROCESS_DIMS = (<span class="hljs-number">300</span>, <span class="hljs-number">300</span>)
    preprocessed = cv2.resize(input_image, PREPROCESS_DIMS)
    preprocessed = preprocessed - <span class="hljs-number">127.5</span>
    preprocessed = preprocessed * <span class="hljs-number">0.007843</span>
    preprocessed = preprocessed.astype(np.float16)
    <span class="hljs-keyword">return</span> preprocessed
</code></pre>
<p>graph&#x63A8;&#x65AD;&#x5F97;&#x5230;&#x76EE;&#x6807;&#x4F4D;&#x7F6E;&#xFF0C;&#x7C7B;&#x522B;&#xFF0C;&#x5206;&#x6570;</p>
<pre><code class="lang-python">graph.LoadTensor(image, <span class="hljs-keyword">None</span>)
(output, _) = graph.GetResult()
</code></pre>
<p>&#x5176;&#x4E2D;&#x7684;output&#x683C;&#x5F0F;&#x4E3A;&#xFF0C;</p>
<pre><code>[
    &#x76EE;&#x6807;&#x6570;&#x91CF;&#xFF0C;
    class&#xFF0C;score&#xFF0C;xmin, ymin, xmax, ymax,
    class&#xFF0C;score&#xFF0C;xmin, ymin, xmax, ymax,
    ...
]
</code></pre><ul>
<li>&#x6839;&#x636E;&#x6211;&#x4EEC;&#x611F;&#x5174;&#x8DA3;&#x7684;&#x7C7B;&#x522B;&#x548C;&#x5206;&#x6570;&#x8FDB;&#x884C;&#x8FC7;&#x6EE4;</li>
</ul>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">predict_filter</span><span class="hljs-params">(predictions, score_thresh)</span>:</span>
    num = <span class="hljs-number">0</span>
    boxes = list()
    scores = list()
    classes = list()
    <span class="hljs-keyword">for</span> (i, pred) <span class="hljs-keyword">in</span> enumerate(predictions):
        (cl, score, box) = pred
        <span class="hljs-keyword">if</span> cl == <span class="hljs-number">21</span> <span class="hljs-keyword">or</span> cl == <span class="hljs-number">45</span> <span class="hljs-keyword">or</span> cl == <span class="hljs-number">19</span> <span class="hljs-keyword">or</span> cl == <span class="hljs-number">76</span> <span class="hljs-keyword">or</span> cl == <span class="hljs-number">546</span> <span class="hljs-keyword">or</span> cl == <span class="hljs-number">32</span>:
            <span class="hljs-keyword">if</span> score &gt; score_thresh:
                boxes.append(box)
                scores.append(score)
                classes.append(cl)
                num += <span class="hljs-number">1</span>
    <span class="hljs-keyword">return</span> num, boxes, classes, scores
</code></pre>
<ul>
<li>&#x7528;OpenCV&#x5C06;&#x5F53;&#x524D;&#x56FE;&#x7247;&#x7684;&#x5BF9;&#x8C61;&#x6570;&#x91CF;&#x5199;&#x5230;&#x56FE;&#x7247;&#x53F3;&#x4E0A;&#x89D2;&#xFF0C;&#x7528;pillow&#xFF08;tf&#x5E93;&#x4E2D;&#x7684;&#x5B9E;&#x73B0;&#xFF09;&#x5C06;&#x5F53;&#x524D;&#x56FE;&#x7247;&#x7684;&#x5BF9;&#x8C61;&#x4F4D;&#x7F6E;&#x548C;&#x7C7B;&#x522B;&#x5728;&#x56FE;&#x4E2D;&#x6807;&#x51FA;</li>
</ul>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">add_str_on_img</span><span class="hljs-params">(image, total_cnt)</span>:</span>
    cv2.putText(image, <span class="hljs-string">&apos;%d&apos;</span> % total_cnt, (image.shape[<span class="hljs-number">1</span>] - <span class="hljs-number">100</span>, <span class="hljs-number">50</span>), cv2.FONT_HERSHEY_SIMPLEX, <span class="hljs-number">1</span>, (<span class="hljs-number">0</span>, <span class="hljs-number">255</span>, <span class="hljs-number">0</span>), <span class="hljs-number">2</span>)
</code></pre>
<pre><code class="lang-python">result = vis_util.visualize_boxes_and_labels_on_image_array(
                image_np,
                np.squeeze(valid_boxes).reshape(num, <span class="hljs-number">4</span>),
                np.squeeze(valid_classes).astype(np.int32).reshape(num, ),
                np.squeeze(valid_scores).reshape(num, ),
                category_index,
                use_normalized_coordinates=<span class="hljs-keyword">True</span>,
                min_score_thresh=score_thresh,
                line_thickness=<span class="hljs-number">8</span>)
</code></pre>
<ul>
<li>&#x4FDD;&#x5B58;&#x56FE;&#x7247;</li>
</ul>
<pre><code class="lang-python"> cv2.imwrite(<span class="hljs-string">&apos;%s_tmp/%s&apos;</span> % (dataset_pref, image_path.split(<span class="hljs-string">&apos;/&apos;</span>)[<span class="hljs-number">-1</span>]),
                        cv2.cvtColor(result, cv2.COLOR_RGB2BGR))
</code></pre>
<ul>
<li>&#x91CA;&#x653E;&#x795E;&#x7ECF;&#x8BA1;&#x7B97;&#x68D2;</li>
</ul>
<pre><code class="lang-python"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">ncs_clean</span><span class="hljs-params">(detection_graph, device)</span>:</span>
    detection_graph.DeallocateGraph()
    device.CloseDevice()
</code></pre>
<h3 id="&#x8FD0;&#x884C;">&#x8FD0;&#x884C;</h3>
<p>python2 ncs_detection.py</p>
<h3 id="&#x7ED3;&#x679C;">&#x7ED3;&#x679C;</h3>
<table>
<thead>
<tr>
<th style="text-align:center">&#x6846;&#x67B6;</th>
<th style="text-align:center">&#x56FE;&#x7247;&#x6570;&#x91CF;/&#x5F20;</th>
<th style="text-align:center">&#x8017;&#x65F6;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">TensorFlow</td>
<td style="text-align:center">1800</td>
<td style="text-align:center">60min</td>
</tr>
<tr>
<td style="text-align:center">NCS</td>
<td style="text-align:center">1800</td>
<td style="text-align:center">10min</td>
</tr>
<tr>
<td style="text-align:center">TensorFlow</td>
<td style="text-align:center">1</td>
<td style="text-align:center">2sec</td>
</tr>
<tr>
<td style="text-align:center">NCS</td>
<td style="text-align:center">1</td>
<td style="text-align:center">0.3sec</td>
</tr>
</tbody>
</table>
<p>&#x6027;&#x80FD;&#x63D0;&#x5347;6&#x500D;&#xFF01;&#x5355;&#x5F20;&#x56FE;300&#x6BEB;&#x79D2;&#xFF0C;&#x53EF;&#x4EE5;&#x8BF4;&#x662F;&#x6BEB;&#x79D2;&#x7EA7;&#x68C0;&#x6D4B;&#x4E86;&#x3002;&#x5728;&#x8BBA;&#x575B;&#x4E0A;&#x6709;&#x9713;&#x8679;&#x56FD;&#x7684;&#x540C;&#x884C;&#x5C1D;&#x8BD5;&#x540E;&#xFF0C;&#x751A;&#x81F3;&#x8BC4;&#x4EF7;&#x5176;&#x4E3A;&#x201C;&#x8D85;&#x7206;&#x901F;&#x201D;&#x3002;</p>
<h2 id="&#x6269;&#x5C55;">&#x6269;&#x5C55;</h2>
<p>&#x5355;&#x6839;NCS&#x4E00;&#x6B21;&#x53EA;&#x80FD;&#x8FD0;&#x884C;&#x4E00;&#x4E2A;&#x6A21;&#x578B;&#xFF0C;&#x4F46;&#x662F;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x7528;&#x591A;&#x6839;NCS&#xFF0C;&#x591A;&#x7EBF;&#x7A0B;&#x505A;&#x68C0;&#x6D4B;&#xFF0C;&#x8FBE;&#x5230;&#x66F4;&#x9AD8;&#x7684;&#x901F;&#x5EA6;&#xFF0C;&#x5177;&#x4F53;&#x53EF;&#x4EE5;&#x770B;Reference&#x7B2C;&#x4E8C;&#x6761;&#x3002;</p>
<h2 id="reference">Reference</h2>
<ul>
<li><a href="https://www.pyimagesearch.com/2018/02/19/real-time-object-detection-on-the-raspberry-pi-with-the-movidius-ncs/" target="_blank">https://www.pyimagesearch.com/2018/02/19/real-time-object-detection-on-the-raspberry-pi-with-the-movidius-ncs/</a></li>
<li><a href="https://qiita.com/PINTO/items/b97b3334ed452cb555e2" target="_blank">https://qiita.com/PINTO/items/b97b3334ed452cb555e2</a></li>
</ul>
<p>&#x770B;&#x4E86;&#x8FD9;&#x4E48;&#x4E45;&#xFF0C;&#x8FD8;&#x4E0D;&#x5FEB;&#x53BB;&#x7ED9;<a href="https://github.com/ahangchen/ncs_detection" target="_blank">&#x6211;&#x7684;GitHub</a>&#x70B9;star!</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../trick/l2_normalize.html" class="navigation navigation-prev " aria-label="Previous page: L2 Norm与L2 normalize">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../kit/" class="navigation navigation-next " aria-label="Next page: 工具">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"实践","level":"1.3.2","depth":2,"next":{"title":"工具","level":"1.3.3","depth":2,"path":"ml/kit/README.md","ref":"ml/kit/README.md","articles":[{"title":"Tensorflow学习笔记","level":"1.3.3.1","depth":3,"url":"https://github.com/ahangchen/GDLNotes","ref":"https://github.com/ahangchen/GDLNotes","articles":[]},{"title":"mscnn","level":"1.3.3.2","depth":3,"path":"ml/kit/caffe/mscnn.md","ref":"ml/kit/caffe/mscnn.md","articles":[]},{"title":"Matlab","level":"1.3.3.3","depth":3,"path":"ml/matlab/README.md","ref":"ml/matlab/README.md","articles":[{"title":"Matlab Remote IPC自动化数据处理","level":"1.3.3.3.1","depth":4,"path":"ml/matlab/ripc_auto.md","ref":"ml/matlab/ripc_auto.md","articles":[]}]}]},"previous":{"title":"L2 Norm与L2 normalize","level":"1.3.1.2","depth":3,"path":"ml/trick/l2_normalize.md","ref":"ml/trick/l2_normalize.md","articles":[]},"dir":"ltr"},"config":{"plugins":["disqus","github","toggle-chapters","mathjax","mermaid-gb3"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"disqus":{"useIdentifier":false,"shortName":"ahangchen-blog"},"github":{"url":"https://github.com/ahangchen/windy-afternoon"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"mermaid-gb3":{},"mathjax":{"forceSVG":false,"version":"2.6-latest"},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"toggle-chapters":{}},"theme":"default","author":"陈伟航","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"梦里茶","gitbook":"*"},"file":{"path":"ml/pratice/ncs.md","mtime":"2018-03-30T16:28:43.667Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2018-05-19T05:00:41.899Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.16.1/URI.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-disqus/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-toggle-chapters/toggle.js"></script>
        
    
        
        <script src="https://cdn.staticfile.org/mathjax/2.6.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-mathjax/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    <script src="../../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>

    </body>
</html>

